<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
	<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
	<title>Hello APP</title>
	<link rel="stylesheet" type="text/css" href="../../css/swiper.css" />
	<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
	<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
	<link rel="stylesheet" type="text/css" href="../../css/common.css" />
	<style>
		.godInfo {
			margin-bottom: 0.25rem;
			background: #FFF;
			padding: 0.75rem;
		}

		.priceInfo {
			padding: 0.25rem 0;
			font-size: 0.6rem;
			color: #adadad;
			line-height: 1rem;
		}

		.priceInfo .price {
			font-size: 0.8rem;
		}

		.coupon {
			position: relative;
		}

		.couponInfo {
			position: absolute;
			left: 0;
			top: 0;
			width: 70%;
			height: 100%;
			color: #FFF;
		}

		.couponInfo .couponNum {
			font-size: 0.7rem;
			margin-bottom: 0.1rem;
		}

		.couponInfo .couponNum span {
			margin: 0 0.15rem;
			font-size: 1.5rem;
			line-height: 1;
		}

		.couponInfo .couponDate {
			font-size: 0.5rem;
		}

		.productDetail {
			background: #FFF;
		}

		.productDetail .ttl {
			font-size: 0.6rem;
			padding: 0.75rem;
		}

		.shop {
			background: #FFF;
			padding: 0.5rem;
		}

		.shop .shopIco {
			width: 1.5rem;
			height: 1.5rem;
			background: url(../../image/common/taobao.png) no-repeat center center;
			background-size: 1.5rem;
		}

		.shop .shopIco.tm {
			background: url(../../image/common/tianmao.png) no-repeat center center;
			background-size: 1.5rem;
		}
	</style>
</head>

<body>

	<div id="detail">
		<img id="img" style="width:100%;" />

		<div style="padding:12px; line-height:30px; color:#999;">
			<div v-text="detail.title"></div>
			<div style="display:flex; justify-content:space-between;">
			<div id="yuanjia" v-text="'原价：'+detail.reserve_price"></div>
			<div id="youhui" v-text="'券后价：'+detail.zk_final_price"></div>
			</div>
			<div>复制这条信息，</div>
			<div><span id="code"></span>,打开【手机淘宝】即可查看</div>
		</div>
	</div>
	<div style="position:relative;">
		<input id="foo" type="text" style="position:absolute:bottom:0;width:100%;" value="" />
		<button class="btn" data-clipboard-action="copy" data-clipboard-target="#foo" style=" position: absolute; z-index:3; width:100%; bottom:0px; background:rgb(244,182,61); color:#fff; padding:12px; height:50px; width:100%; border:none">复制分享链接</button>
	</div>

</body>
<script type="text/javascript" src="../../script/clipboard.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>

<script type="text/javascript">
var clipboard = new Clipboard('.btn');
clipboard.on('success', function(e) {
	console.log(JSON.stringify(e));
});

clipboard.on('error', function(e) {
	console.log(2)
	console.log(e);
});

	apiready = function() {

		api.parseTapmode();
		GOD_ID = api.pageParam.shopId;

		console.log(JSON.stringify(api.pageParam))

		var userInfo = getUserinfo()
		console.log()
		$('#img').attr('src',api.pageParam.img)
		$('#yuanjia').text('原价：'+api.pageParam.item.reserve_price)
		$('#youhui').text('券后价：'+api.pageParam.item.reserve_price)
		getCode(api.pageParam.item)

		function getCode(item) {
			let _this = this
			api.ajax({
				url: BASE_URL + 'app/select/modelGenerate',
				method: 'post',
				data: {
					values: {
						coupon_share_url: item.url,
						pict_url: item.pict_url,
						user_nickname: userInfo.user_nickname,
						// shot_title: item.title,
						userid:userInfo.userid,
						numid:item.num_iid,
					}
				}
			}, function(ret, err) {
				console.log(JSON.stringify(ret))
				$('#foo').val(ret.data.model)
				$('#code').text(ret.data.model)
			});
		}

	}

</script>

</html>
